#include <iostream>
using namespace std;
#include <math.h>

//int Sum_Squares(int n)
//{
//    int ret = 0;
//    while (n)
//    {
//        // ret += sqrt(n % 10);
//        int tmp = n % 10;
//        ret += tmp * tmp;
//        n /= 10;
//    }
//    return ret;
//}
//
//bool isHappy(int n) {
//    int slow = n, fast = n;
//    slow = Sum_Squares(slow);
//    fast = Sum_Squares(slow);
//    while (slow != fast)
//    {
//        slow = Sum_Squares(slow);
//        fast = Sum_Squares(fast);
//        fast = Sum_Squares(fast);
//    }
//    return slow == 1;
//}
//
//int main()
//{
//    isHappy(2);
//}


int maxArea(vector<int>& height) {
    int left = 0;
    int right = height.size() - 1;

    int Cap = 0;
    while (left < right)
    {

        int tmp = min(height[left], height[right]) * (right - left);
        Cap = max(tmp, Cap);

        if (height[left] < height[right]) ++left;
        else --right;
    }
    return Cap;
}